﻿<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:forEach var="upmsPermission" items="${upmsPermissions}" varStatus="status">
    <c:if test="${upmsPermission.pid == 0}">
    <li>
        <!--目录-->
        <c:if test="${upmsPermission.type == 1}">
            <a href="#">
                    <i class="${upmsPermission.icon}"></i>
                    <span class="nav-label">${upmsPermission.name}</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <c:forEach var="subUpmsPermission" items="${upmsPermissions}">
                        <c:if test="${subUpmsPermission.pid == upmsPermission.permissionId}">
                            <!--目录-->
                            <c:if test="${subUpmsPermission.type == 1}">
                                <li>
                                    <a href="#">
                                        <i class="${subUpmsPermission.icon}"></i>
                                        <span class="nav-label">${subUpmsPermission.name}</span>
                                        <span class="fa arrow"></span>
                                    </a>
                                    <ul class="nav nav-third-level">
                                        <c:forEach var="sub3UpmsPermission" items="${upmsPermissions}">
                                            <c:if test="${sub3UpmsPermission.pid == subUpmsPermission.permissionId}">
                                                    <c:forEach var="upmsSystem" items="${upmsSystems}">
                                                        <c:if test="${sub3UpmsPermission.systemId == upmsSystem.systemId}">
                                                            <c:set var="systemBasePath" value="${upmsSystem.basepath}"/>
                                                        </c:if>
                                                    </c:forEach>
                                                    <li><a class="J_menuItem" href="${systemBasePath}${sub3UpmsPermission.uri}"><i class="${sub3UpmsPermission.icon}"></i>${sub3UpmsPermission.name}</a></li>
                                            </c:if>
                                        </c:forEach>
                                    </ul>
                                    </li>
                            </c:if>
                            <!--菜单-->
                            <c:if test="${subUpmsPermission.type == 2}">
                                <c:forEach var="upmsSystem" items="${upmsSystems}">
                                    <c:if test="${subUpmsPermission.systemId == upmsSystem.systemId}">
                                        <c:set var="systemBasePath" value="${upmsSystem.basepath}"/>
                                    </c:if>
                                </c:forEach>
                                <li><a class="J_menuItem" href="${systemBasePath}${subUpmsPermission.uri}"><i class="${subUpmsPermission.icon}"></i>${subUpmsPermission.name}</a></li>
                            </c:if>
                        </c:if>
                    </c:forEach>
                </ul>
        </c:if>

        <!--菜单-->
        <c:if test="${upmsPermission.type == 2}">
            <c:forEach var="upmsSystem" items="${upmsSystems}">
                <c:if test="${upmsPermission.systemId == upmsSystem.systemId}">
                    <c:set var="systemBasePath" value="${upmsSystem.basepath}"/>
                </c:if>
            </c:forEach>
            <li class="system_${upmsPermission.systemId} ${status.index}">
                    <a class="J_menuItem" href="${systemBasePath}${upmsPermission.uri}"><i class="${upmsPermission.icon}"></i> ${upmsPermission.name}</a>
            </li>
        </c:if>
    </li>
    </c:if>
</c:forEach>